import 'package:flutter/material.dart';

class Home extends StatelessWidget {
  const Home({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Image Demo"),
        actions: [IconButton(onPressed: () {}, icon: Icon(Icons.share))],
      ),
      body: ImageDemo(),
    );
  }
}

//Image :
//加载 asset中的图片   Image.asset()  或者 Image(image:AssetImage("图片路径"))
//加载网络图片: Image.network("地址") 或者 Image( image: NetworkImage( "网络地址"))

// 属性: 
//fit: 用于在图片的显示空间和图片本身大小不同时指定图片的适应模式
//repeat：当图片本身大小小于显示空间时，指定图片的重复规则



class ImageDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Image.asset(
          'images/guanggao.png',
          width: 200,
          height: 100,
          fit: BoxFit.fitWidth,
          repeat: ImageRepeat.repeat,
        ),
        Image.network(
          "https://img14.360buyimg.com/n0/jfs/t1/180738/35/17355/221785/6107e04aE152a6c7c/82b4fb0cf37fd718.jpg",
          repeat: ImageRepeat.repeatY,
        )
      ],
    );
  }
}
